perm filename SOSMUS.MAN[MAN,LCS] blob
sn#051332 filedate 1974-02-21 generic text, type T, neo UTF8
STANFORD ARTIFICIAL INTELLIGENCE LABORATORY October 1970
OPERATING NOTE 50.3 1971 addendum
SON OF STOPGAP
by
William Weiher and Stephen Savitzky
CREDITS
The original STOPGAP text editor was designed and programmed by Bill
Weiher. Steve Savitzky added text justification (JU, JC, JR, and JL
commands) and more extensive string search features. Dan Swinehart
subsequently added display line editor commands (Z and Q) and
automatic file saving (SAVE and ISAVE). This manual has been
rewritten by Les Earnest.
1. INTRODUCTION
SOS provides the ability to insert, delete, modify, and print lines
of text. While most commands are line-number oriented, string search
and substitution commands are available. Commands are discussed
below roughly in order of increasing complexity. It is suggested
that you begin by reading Sections 1 and 2, then do some text
editing. Successive sections describe more elegant functions and may
be consumed one at a time.
A command to the editor consists of one or two characters followed by
a list of arguments. The input format is free field i.e., spaces are
ignored except that they delimit numbers and identifiers. Tabs are
treated as multiple spaces.
1.1 OPERATION
To edit an existing text file named FOO, say EDIT FOO to the monitor
(or just ED FOO). This will start SOS and look up FOO. When SOS is
ready to accept a command, it will type "*". If FOO isn't found it
will say so, then type "FILE=" and expect you to give another name.
If the file name includes a project-programmer number other than the
one you are logged in under, the original file will not be changed,
but a new version will be created in your area.
If you wish to read a file but not modify it, you may type /R at the
end of the line, which puts you in read-only mode. In this case, any
attempt to modify the file will give an error message.
To create a new file called GARP.BAZ, type CREATE GARP.BAZ. SOS will
normally respond with "100", representing the number of the first
line, and expect you to type in some text. If you attempt to create
a file that already exists, SOS will say
FILE ALREADY EXISTS! DELETE (Y OR N)
If you type N, SOS will respond with "FILE=" so that you can select a
new file name. If you type Y, the old file of that name will be
deleted and the edit may proceed. Typing anything other than Y or N
will cause SOS to respond with "TYPE Y OR N" and "FILE=".
If you decline to use the RPG commands (known as CCL commands in the
great world outside), you may say R SOS to the monitor, or even RUN
SYS: SOS. SOS will respond with FILE= and expect a file name. If
you follow the name with a carriage return, it is equivalent to the
EDIT command, while if you end with ALTMODE it will CREATE.
SAILON-50.3 SOS Editor INTRODUCTION 1-2
1.3 SPECIFYING LINES AND RANGES
The text file is organized in terms of pages which are subdivided
into lines. The pages are numbered sequentially starting at 1 and
continuing to the end of the file. The division into pages is
determined by the user rather than by the editor. Page marks (which
indicate the start of a page) may be inserted and deleted by the
user. Page numbers are "floating"; that is if page mark 2 were
deleted, the page which was formerly numbered 3 would now be page 2.
In contrast to this each line on a given page has a line number which
is "sticky". That is, a given line will retain the same number
regardless of insertions or deletions. The lines are usually
numbered by 100 or some other increment larger than 1 to allow room
to insert new lines. Several pages may have lines of the same
number.
Most SOS commands refer to either a single line or a range of
successive lines. A single line is specified by giving both the line
number and the page number in the form <line number>/<page number> as
100/3 for line 100 on page 3. A range is specified by giving the
first and last lines of the range separated by a colon as
100/3:4702/6 for line 100 on page 3 through line 4702 on page 6.
Alternatively, a range may be specified by a starting line and a
number of lines. For example, 200/4!10 refers to the 10 lines
beginning on line 200 of page 4. In either case, this construction
is refered to as a range specifier.
Instead of a number the symbol "." may be used. "." means either the
current page or the current line depending on whether it appears
after or before the /. Thus 100/. means line 100 on the current
page and ./3 means the current line on page 3 (the line on page 3
which has the same line number as the current line). The current
line and page are determined by the last command which was executed
(see the individual commands for further details).
For ease of use, some of the specifications may be omitted. If the
page number of the specification is omitted, it is assumed to be the
current page (in this case the slash is also omitted). Thus 400/.
and 400 specify the same line. If the page number for the end of a
range is omitted, it is assumed to be the same as that for the start
of the range. Thus 400/7:3120/7 and 400/7:3120 specify the same
range. So do 400/.:700/. and 400:700.SAILON-50.3 SOS Editor INTRODUCTION 1-4
If just a page number is given with no line number, it means all the
lines on that page. Thus /3 means all the lines on page 3 (except
for the delete command). Omitting the first line number of a range
means the first line of that page, while omitting the second line
number means the last line on that page. Thus /3:/5 specifies all
the lines on pages 3 through 5. It is not legal to omit both the
line and page number (thus :100/6 is not legal).
Relative page and line numbers may be used instead of absolute ones.
Thus 100+3/. .+27/4 and .-5/.+6 are all legal specifications. For
pages this has the obvious meaning (if you are on page 5, then /.-4
is page 1). For line numbers however, .+n means the nth line after
the current one. Thus if a file has lines numbered 100, 103, 106,
109, 111, 142, and 200 and if the current line is 100, then .+3 is
line 109 not line 103. The start and end of the page act as
boundaries for relative line numbers as follows: If a page has lines
numbered 100, 200, 300, 400, 500, and 600, and if 300 is the current
line, then .+3, .+4, etc. are all line 600. Similarly .-2, .-3,
etc. are all line 100.
The symbol "*" may be used to specify the last line on a page. "*"
may not be used to specify a page. Expressions such as "*-4" are
permitted.
Set commands).SAILON-50.3 SOS Editor BASIC COMMANDS 2-1
2. BASIC COMMANDS
The syntax of each command below is shown with optional arguments
enclosed in parentheses. Where two or more arguments are shown with
"|" between them, it means that any one (but only one) may be used.
Thus the I command, below, may take any of the following forms.
I
I<line>
I<line>,<increment>
Insert--I(<line>)(,<increment>)
The insert command is used to insert new lines into the file. Insert
accepts a single line specifier as its argument and begins inserting
at that line. Each time you complete a line, SOS will add the
current increment to the number of the line just inserted and try to
insert that line. The current increment may be set by giving a
second argument to the insert command. Thus I100,30 will start
inserting at line 100 and set the increment to 30. The increment is
set to 100 at the start of editing.
When inserting, SOS will type out the number of the next line to be
inserted. The user should then type the desired text of that line
followed by a return. SOS will then either print the line number of
the next line to be inserted or will return to command mode and print
a "*".
To stop inserting, type an ALTMODE. This causes the line in which it
appears not to be inserted and returns to command mode. When an
altmode is given, the number of that line is remembered and will be
used if the next "I" command is given with no arguments.
If the first line to be inserted specifies a page which does not
exist, SOS will respond with *NO SUCH PAGE*. While inserting, you
may correct typing errors using the system editing commands (see
SAILON-54, Section I.C.3).
Example:
*I100
00100 NOW IS THE
00200 TIME FOR ALL
00300 <altmode>
*p100
00100 NOW IS THE
*I
00300 GOOD MEN
00400 ...
If the line at which inserting is to start already exists, an insert
will be done on line <number> + <current increment> unless there is a
line with a number between <number> and <number> + <current
increment> in which case the line number will be halfway between
<number> and the number of the next line in the file. If, however,
any subsequent line which is to be inserted already exists, or if a
line with number between two consecutive lines of the insert exists,
then the insert will terminate and SOS will return to command mode.
As an example, suppose a file has lines numberd 100, 200, 300, 400,
and 500. The command I120,40 would allow lines 120 and 160 to be
inserted and then would automatically return to command mode. The
command I120,20 would allow lines 120, 140, 160, and 180 to be
inserted and then would return to command mode.
The current line and page are set to the last line actually inserted
(not the one terminated with altmode) on the specified page. If an
attempt is made to insert a line containing more than 147 characters
(not counting the return at the end) the error *LINE TOO LONG* will
be given, the line will not be inserted, and SOS will return to
command mode. If the next line to be inserted would have a number
greater than 99999, SOS will stop inserting and return to command
mode.
Delete--D<range>
The delete command will accept a range specifer as its only argument
and will delete all of the lines specified. If there were no lines
in the range specified, SOS will respond with *NO SUCH LINE(S)*.
There are two exceptions to the normal manner of specifying lines.
The delete command will not allow a page specification for the second
line number of a range. Thus the command D100/5:200/6 is illegal and
will result in the error message *ILLEGAL COMMAND*.
The second exception is that the command D/5 will not delete all of
page 5, but will instead delete page mark 5. This may result in the
error message *OUT OF ORDER*, indicating that the deletion results in
a page on which there are some sequence numbers not in proper order
(e.g. 100, 200, 300, 150, 200). Note that the deletion has been
made. The correct procedure at this point is to renumber all of the
lines on the appropriate page (4 in the above example). See the
Number command.
All of the lines on page 5 may be deleted by the command D0/5:99999.
An attempt to remove page mark 1 (D/1) or some page mark which does
not exist will result in the error message *NO SUCH PAGE*. The
current line and page are set to the last line deleted on the
specified page. Note that after a deletion, the command P. will
give *NO SUCH LINE(S)*.
Print--P(<range>)(,S)
The print command accepts a range specifier as its argument. The
lines specified will be printed on the teletype. The current line
and page will be set to the last line actually printed. If the range
specified has no lines in it the error *NO SUCH LINE(S)* will be
given. If the range of printing includes the boundary between two
pages, "PAGE n" will be printed to indicate the presence of the page
mark. The command P<return> is the same as P.!16<return>.
If a second argument of ,S is given, line numbers will be suppressed
in the printout. This is useful for clean copies on a TTY model 37.
In adition, page numbers will not be printed, and the * for the next
command will be suppressed, so that copies so generated will be
absolutely clean.
List--LS(<range>)(,S)
List is like print in format and error messages, but the output goes
to the line printer instead of the teletype. Page headings will be
printed at the top of each line printer page: the name of the file,
the time and date of printing, and the page number. Page numbers are
given in the form M-N. where M is the actual SOS page number on
which this text can be found and N denotes the N-th page of line
printer paper required for logical page M. The current line and page
are set to the last line printed. If no range specification is
given, the entire file will be listed.
The S option for suppressing line nmbers and headings also applies to
the List command. Unlike the print command, however, the * for the
next command will print, as there is no reason for it not to.
End--E(<file name>)
This command is used to terminate the edit. If no arguments are
given the old copy of the file being edited will be deleted and the
new copy will be renamed to the old name. If an argument is given it
will be taken as a file name (it sould be of the form foo or foo.baz)
and the new copy of the file will be given this name.
If a new name is specified and a file of this name already exists,
the message
FILE ALREADY EXISTS! DELETE? (Y OR N)
will be given followed by a "*". If "N" is typed, SOS will respond
with a "FILE=" and wait for a new file name to be given. If "Y" is
typed, the old file will be deleted and the new one substituted.
Typing anything else will result in the message TYPE Y OR N. If the
old file can not be deleted (this may also happen if you are creating
a file with the same name as an already existing file), the message
FILE IN USE OR WRITE PROTECTED. TRY AGAIN
will be given followed by a "FILE=". At this point a new file name
must be selected. SOS will return to the monitor when it has
finished.SAILON-50.3 SOS Editor INTERMEDIATE COMMANDS 3-1
3. INTERMEDIATE COMMANDS
save World--W(<file name>)
The W command is the same as the E command except that it leaves you
editing in the same place. This command is useful for saving the
current version of the file in case the system should die. File
names given to W commands are "sticky", and need not be given twice.
Display Alter-- Z(<range>)
This command is valid only if you are using a Stanford display
console. Each line in the range is sent back to the time-sharing
system for alteration. Initially, the text-editing cursor will be
set at the first character in the line. All editing features which
are operative while inserting text (using the "I" command) are
available for altering the line. See SAILON-54, Section I.C.3 for
details.
SAILON-50.3 SOS Editor INTERMEDIATE COMMANDS 3-3
Alter--A<range>
This command is used to make changes within a line without having to
retype the entire line. It accepts a range specifier indicating the
lines to be altered. For each of the lines in the range, it prints
the line number and then enters a special intra-line editing mode
which has its own commands. These commands are not echoed on the
teletype, so that the line shown on the teletype at the end of the
intra-line edit is nearly the same as the line which will appear in
the text.
The intra-line editor maintains a pointer within the line being
changed. This pointer points to the character which the next command
will effect. The pointer is initially placed pointing to the first
character of the line. In general, any command in this mode may be
preceeded by a number which will cause it to be repeated that number
of times. For example, the command 10D causes 10 characters to be
deleted.
next--<space>
This command causes the character pointed to to be printed on the
teletype and the pointer to be moved right one character. If the
pointer is already at the extreme right of the line, the command is
ignored.
back--<rubout>
Moves the pointer to the left one character. If the pointer is
already at the extreme left of the line, a <return><line feed> is
done and the number of the line is printed again. The pointer then
points to the first character of the line. The characters moved over
are printed surrounded by \'s.
Thus, if the line being edited is "How now ..." and the intra-line
commands 7<space>, 3<rubout>, <space> are given, the printed line
will say "How now\won\n" and the pointer will be on the "o".
Change--C
This command causes a character to be accepted from the teletype.
This character is printed and replaces the character pointed to. If
the pointer is at the extreme right of the line, the command will be
ignored. <rubout> from the teletype will be ignored.
<line feed>,<return>, or <altmode> will cause the remainder of the C
command to be aborted. This is useful if a number was used which
proves to be too large.
Delete--D
This command deletes the character pointed to. The deleted
characters will be printed surrounded by \\'s. If the pointer is at
the extreme right of the line, the command is ignored. After the
command, the pointer will be pointing to the character to the right
of the one deleted. If this command is preceeded by a number, only
the last 3 characters deleted will be printed, surrounded by \\'s.
Insert--I
This command causes characters from the teletype to be printed and
inserted into the line just ahead of the pointer until an <altmode>
is seen. The pointer is left pointing at the character to the right
of those inserted.
<rubout> causes the character to the left of the pointer to be
deleted. This character will usually be the last character inserted,
but it is possible to delete more characters than were inserted.
Typing <rubout> when at the left end of the line has no effect. The
characters deleted are printed surrounded by \'s.
If enough characters are inserted to make the total length of the
line more than 147, the error *LINE TOO LONG* is given and SOS
returns to command mode without having made any changes in the line
being altered.
If a <return> or <line feed> is seen a <return><line feed> will be
inserted at that point. This will create a new line whose contents
are that part of the line to the right of the present pointer
position. The number of this new line will be determined as follows:
If the I command was preceded by a number, this number will be added
to the current line number to produce the "provisional line number".
If there was no number preceding the I command, the "provisional line
number" will be created by adding the current insert increment to the
current line number. If the "provisional line number" can be used
without producing an order or wrap around error, it will be used. If
not, the new line will be given a number which is halfway between
that of the current line and the number of the next line. If the
number of the next line is only one more than the current line
number, an *OUT OF ORDER* error will be given, SOS will retype the
line number and the contents of the line to the left of the pointer.
SOS will then be ready to accept more characters to be inserted.
If no errors occur the pointer will be left pointing at the first
character of the new line and the current line will be set to the new
line created.
finish--<line feed> or <return>
Causes the part of the line to the right of the pointer to be printed
and the intra-line edit to be finished. If any lines remain in the
range specified for the alter command, the intra-line edit of the
next is started, otherwise SOS returns to command mode.
4. OTHER USEFUL COMMANDS
Replace--R<range>(,<increment>)
This command is the same as a delete command followed by an insert
command. It accepts a range specifier and an optional second
argument (separated from the first by a comma) which if present will
be used to set the increment. It performs a D command using the
range specifier given and then an I command with the first line
specified by the range specifier.
There are some slight differences between the R and D commands.
Whereas D/3 will delete page mark 3, R/3 will replace all of the
lines on page 3. In addition, the R command will never give
*NO SUCH LINE(S)* error messages.
next line--<line feed>
This command causes the next line of the file to be printed. If the
current line is the last of the file, the error NO SUCH LINE(S) will
be given. If the current line is the last one on the current page,
PAGE n will be printed where n is the number of the next page. If
there are several blank pages the following typeout may result:
PAGE 10
PAGE 11
PAGE 12
PAGE 13
00100 This is the first line on page 13.
previous line--<altmode>
This command prints the line before the current line. If the current
line is the first line of the file, the error NO SUCH LINE(S) will be
given. Page numbers may be printed as in the <line feed> command.
Copy--C<dest>(←<file>(/S)),<source>(,<inc1>)(,<inc2>)
The Copy command will insert a copy of a given piece of text in a
given location. The source for the text may be on the file being
edited or on some other file. The basic form of the Copy command is:
C<destination>,<source range >,<increment>
The Copy command acts as if an I<destination>,<increment> had been
done and then all of the lines specified by the <source range > had
been typed in. The current line is set to the last line entered.
If the <increment> is large enough that it would cause an *ORDER* or
a *WRAP AROUND* error, the Copy command will pick a smaller
increment. The message "INC1=<number>" will be printed to show what
increment was chosen. If it is impossible to choose a small enough
increment, either "INC1=ORDER" or "INC1=WAR" messages will appear and
the given increment will be used.SAILON-50.3 SOS Editor OTHER USEFUL COMMANDS 4-2
If the source lines contain page marks, the renumbering of lines will
cease when the first page mark is reached. Lines between the first
and last page marks will be inserted with their original numbers.
Lines after the last page mark will be inserted with their original
line numbers unless a second increment is given. This increment
should appear immediately after the first increment and be seperated
from it by a comma. If the second increment is so large that *ORDER*
or *WRAP AROUND* errors would occur or if no second increment is
given and an *ORDER* error would occur if no renumbering were done,
SOS will choose an increment to use. SOS will print "INC2=<number>"
to indicate the increment chosen. If there is no suitable increment,
SOS will print "INC2=ORDER" and use the specified increment or the
original line numbers if no second increment is given.
If the source lines are to be on some file other than the one being
edited, the Copy command is given as:
C<destination>←<source file name>,<source range specifier>...
This command may give either of the errors *FILE NOT FOUND* or
*DISK NOT AVAILABLE*.
Transfer--T<dest>,<source>(,<inc1>)(,<inc2>)
The Transfer command moves a set of lines from one place on a file to
another. It acts like a Copy command followed by a Delete command.
It has only two differences from the Copy command. The first
difference is that the source lines must be on the file being edited.
The second difference is that the error message
*ILLEGAL TRANSFER DESTINATION* may be given. This error will occur
when the destination is inside the source range. (i.e.
C400/5,/2:/9)
If the deletion would produce an order error because of the removal
of a page mark, SOS will reinsert one page mark and type
PAGE MARK INSERTED TO PREVENT ORDER ERROR
If the destination specified is on a page which does not exist, SOS
will insert the text at the end of the file and type
TEXT INSERTED AT END OF FILESAILON-50.3 SOS Editor OTHER USEFUL COMMANDS 4-3
eXtend--X<range>
This command is like the Alter command except that on each line it
automatically puts the pointer at the right end of the line in insert
mode. It is useful for adding comments to lines.
display extend-- Q(<range>)
This command is like the eXtend command, except that the system line
editor is used. The pointer is positioned to the end of the line;
you are therefore in a mode ready to append characters.
5. ADVANCED COMMANDS
Join--J<line>
The join command is used to join two successive lines into one. Its
argument is the first of the pair of lines to be joined. The new
line formed will be given the number of the first of the pair. The
error message *LINE TOO LONG* may be given, in which case, the lines
will be unchanged. If the line given is the last line on a page, the
error message *NO NEXT LINE* will be given. The current line will be
set to the line created if there are no errors.
JUstify--JU<range>
This command takes a range as its argument. Note that there are two
letters in the command. It justifies the text in the range by
ignoring all line numbers, carriage returns and line feeds in the
range, and inserting its own in such a way that adding an extra word
to a line would cause its length to exceed RMAR(right margin) -
LMAR(left margin)+1 characters. (See the "←" command, above, for a
list of initial values for parameters.) A word is taken to be
anything between blanks. The end of a line is considered a blank. If
a word ends in ".", "?", or "!", two blanks are permitted after it.
Otherwise, only one blank is permitted, and others are ignored.
Next, extra blanks are inserted between words, starting from the left
and right on alternate lines, to make the length of the line exactly
RMAR-LMAR+1. Then LMAR-1 blanks are inserted in front of the new
line, and it is given a line number which is the same as if the new,
justified text had been numbered with a N<INC>,<range> command. A
pagemark is automatically generated if the line number for the next
line would exceed MAXLN. You will be told if this occurs.
There are exceptions to the above proceedure, all having to do with
paragraphing. Any of the following conditions are treated as the end
of a paragraph: TAB in first column (note that tabs in other places
do not start paragraphs), BLANK LINE, PAGE MARK, BEGINNING or END of
RANGE.
When one of the above conditions is encountered (except of course
beginning of range), the immediately preceeding line is not expanded.
It is, however, moved out to LMAR by the insertion of leading blanks,
if necessary.
If the new paragraph begins with a TAB, the tab is merely inserted
into the text. If not, the first line of the paragraph is made to
start at PMAR (paragraph margin) rather than LMAR.
SAILON-50.3 SOS Editor ADVANCED COMMANDS 5-2
Justify Left--JL<range>
Lines in the range are left justified by removal of leading blanks,
and the insertion of LMAR-1 leading blanks to move them out to the
left margin. Paragraphs have their first lines treated as in the JU
command. No chopping, filling, renumbering, etc. is done.
Justify Right--JR<range>
Like JL, only enough blanks are inserted to move the line out to the
right margin. The required blanks are inserted to the right of the
rightmost tab in the line.
Justify Center--JC<range>
Like JR, only half as many blanks are inserted, so that the line ends
up centered between LMAR and RMAR.
For a summary of the parameters used in the Justify family of
commands, their initial values, meanings, and how to change them, see
the Set(←) and Give(=) commands.
Find--F(<string>)<altmode>(<range>)(,A|,N)(,E)(,<number>)
The Find command is used for locating occurrences of given strings of
text. The basic form of the Find command is:
F<string><altmode><range>
The first occurrence of the specified string within the specified
range will be found and the line containing that string will be
printed. If the range includes more than one page and the line found
is not on the first page of the range, PAGE n will be printed where n
is the number of the page on which the line occurs. For example, to
find the first occurrence of the string "FOOBAR" on page 5, use the
command:
FFOOBAR$/5
where $ is used to indicate an altmode. To use the same string used
by the last F command, simply omit the string (but not the
<altmode>). For example, after the above search, to find the first
occurrence of the string "FOOBAR" on page 14, use the command:
F$/14
Note that it is possible to determine what string will be used in
such a case by using the =STRING command. If no previous F command
was done, the error message *NO STRING GIVEN* will be printed if the
string is omitted. Upper and lower case letters will be considered
the same inside <string>. Thus the strings "FOO" and "Foo" will find
the same lines. The use of <return>, <line feed>, ≡, ¬, ∞, |, and ∀
in search strings should be avoided until you learn how to use them.
(See the section below on Special Characters).
If the range is omitted (e.g. FFOOBAR$) then the range searched will
be from the line after the present one (essentially .+1) to the end
of the file. To search from the present position to some location,
give only the second half of the range. Thus to search from .+1 to
the end of page 10, use:
FFOOBAR$:/10
Giving the command F<return> will cause the search to continue from
the present point. This differs from the command F$<return>, which
searches to the end of the range specified in the previous search
command instead of continuing to the end of the file.
If no occurrence of the string is found in the given range, SOS will
simply print a * and wait for the next command. The current line
will be set to the last line found. If no line is found, the value
of . will be unchanged.
Multiple Strings
To search for more than one string at the same time, seperate the
strings by a <return>. Thus to find the first occurrence of either
"FOO" or "BAZ" on page 5 use the command:
FFOO
BAZ$/5
If too many strings are specified in this manner, the error message
*TOO MANY STRINGS* will be given. The current limit on number of
strings is 6. The error message *STRING TOO LONG* will be given if
the total length of all strings being searched for is greater than
the table space available (currently 200 characters).
Alter switch (,A)
It is possible to cause SOS to enter intra-line edit mode
automatically when a string is found. To do this, append ",A" after
the range when giving the F command as:
FFOOBAR$/5,A
or FBAZ$,A (range omitted)
When a match is found while using this feature, SOS will enter
intra-line edit mode (A command) and move the intra-line edit pointer
to point to the first character of the string found (using the
<space> command). If the F<return> command is used after editing of
that line is finished, the ",A" will remain in effect. Thus
F<return> is really a continue command even as far as special modes
are concerned. This effect of the F<return> command also holds for
the N and E modes explained below.
Substitute--S((<ostirng><altmode><nstirng>)<altmode>
(<range>)(,D|,N)(,E)(,<number>)
This command is used to substitute one string for all occurrences of
another string. The basic form of the Substitute command is:
S<ostring><altmode><nstring><altmode><range>
<nstring> will be substituted for all occurrences of <ostring> in the
given range. Note that while the F command finds the first
occurrence, the S command substitutes for all occurrences. The
Substitue command will print all lines on which substitutions have
been made. The line will be printed after all substitutions on that
line have been made. As with the F command, "PAGE n" will be printed
if the first line printed is not on the first page of the given range
or if a subsequent line is not on the same page as a previous line.
For example, to change all occurrences of FOO to BAZ on page 17, use
the command:
SFOO$BAZ$/17
To use the same strings as were used by the last S command, simply
omit both strings and one of the <altmode>'s. Thus if it were now
desired to change all FOO's to BAZ's on page 33, one could use the
command:
S$/33
Note that as with F, it is possible to determine which strings will
be used by using the =STRING command. If the strings are omitted and
no previous S command has been given, the error message
*NO STRING GIVEN* will be printed. Again as with F, upper and lower
case characters will be considered the same in the first of the two
strings (but not in <nstring>).
The effect of omitting the range or of specifying only the last half
of the range is the same as for the F command. S<return> is a
continue in the same manner as F<return> but is rarely needed since
the S command affects all lines in the given range. The current line
is set to the last line changed. If no substitutions are made, the
value of "." is unchanged.
Multiple Substitution
As with the F command it is possible to do several substitutions at
the same time. Several strings to be searched for, seperated by
<return>'s, may be given for <ostring> followed by an <altmode>, then
several strings to replace them, again seperated by <return>'s, are
given for <nstring> followed by another <altmode>. The first string
given for <nstring> will be substituted for the first given for
<ostring>, the second for the second, etc. If more <ostring>'s than
<nstring>'s are given, the last <nstring> will be used to substitute
for the excess <ostring>'s. Thus to simultaneously substitute ALPHA
for BETA and DELTA for GAMMA on page 5 through page 7 use the
command:
SBETA
GAMMA$ALPHA
DELTA$/5:/7
The errors *TOO MANY STRINGS* and *STRING TOO LONG* will occur under
the same circumstances as for F.
APPENDIX C
SUMMARY OF COMMANDS
The following is a brief summary of SOS commands. Those arguments
enclosed in () may be omitted. Where several arguments appear,
seperated by |, it means that any one of these (but only one) may be
used. [] are used for grouping.
Alter A<range>
<space> next character
<rubout> last character
C Change
D Delete
I Insert
<return> end alter mode
Q Quit
<control U> start over
S Skip
K Kill
R Replace
L Line
P Print
J Justify
Copy C<dest>(←<file>(/S)),<source>(,<inc1>)(,<inc2>)
Delete D<range>
End E (<file name>)
Find F((<string>)<altmode>(<range>)(,A|,N)(,E)(,<number>))
Go G (<file name>)
Insert I<line>(,<increment>)
Join J<line>
Justify Center
JC<range>
Justify Left
JL<range>
Justify Right
JR<range>
JUstify
JU<range>
List L(<range>)(,S)SAILON-50.3 SOS Editor SUMMARY OF COMMANDS C-2
Mark M<line>
Number N<increment>,<range>(,<starting number>)
display extend
Q<range>
Print P(<range>)(,S)
Replace R<range>(,<increment>)
Substitute
S((<ostrng><altmd><nstrng>)<altmd>(<rng>)(,D|,N)(,E)(,<number>)
Transfer
T<dest>,<source>(,<inc1>)(,<inc2>)
save World
W(<file name>)
eXtend X<range>
display alter
Z<range>
APPENDIX E
1971 ADDENDUM
II. =FILE COMMAND
The =FILE command types for you the name, extension, and
proj/prog (input) names of the file you are editing. In addition,
a /R will be printed if you are in read-only mode.
III. CARRIAGE RETURN INSERTION IN `Z' MODE
If you type <meta>RETURN in `Z' (`Q') mode, a new line will
be begun with the remainder of the line on it; you will still be in
`Z' mode. The details are analogous to those for inserting a RETURN
in `A' mode (see manual).
IV. `Z' OPTION IN THE SEARCH COMMAND
Read the compilete description of the search (F for FIND)
command. If in place of `,A' you type `,Z', good things will
happen to you.
DCS 3-28-71